package usbcali.edu.persistencia.dto;

import usbcali.edu.persistencia.CentroDeCostos;

import usbcali.edu.presentation.backEndBeans.CentroDeCostosView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class CentroDeCostosDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String descripcion;
    private String codCc;
    private boolean rowSelected = false;
    private CentroDeCostosView centroDeCostosView;
    private CentroDeCostos centroDeCostos;

    public CentroDeCostos getCentroDeCostos() {
        return centroDeCostos;
    }

    public String listener_update(ActionEvent e) {
        try {
            centroDeCostosView.action_modifyWitDTO(((codCc == null) ||
                codCc.equals("")) ? null : new String(codCc),
                ((descripcion == null) || descripcion.equals("")) ? null
                                                                  : new String(
                    descripcion));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codCc = centroDeCostos.getCodCc().toString();
        descripcion = (centroDeCostos.getDescripcion() != null)
            ? centroDeCostos.getDescripcion().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codCc = centroDeCostos.getCodCc().toString();
        descripcion = (centroDeCostos.getDescripcion() != null)
            ? centroDeCostos.getDescripcion().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setCentroDeCostos(CentroDeCostos centroDeCostos) {
        this.centroDeCostos = centroDeCostos;
    }

    public CentroDeCostosView getCentroDeCostosView() {
        return centroDeCostosView;
    }

    public void setCentroDeCostosView(CentroDeCostosView centroDeCostosView) {
        this.centroDeCostosView = centroDeCostosView;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getCodCc() {
        return codCc;
    }

    public void setCodCc(String codCc) {
        this.codCc = codCc;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
